package com.ringtheweb.web.interceptor;

import org.jboss.seam.annotations.intercept.AroundInvoke;
import org.jboss.seam.annotations.intercept.Interceptor;
import org.jboss.seam.intercept.InvocationContext;


@Interceptor
public class PerfInterceptor {
	
	
	@AroundInvoke
	public Object aroundInvoke(InvocationContext ctx) throws Exception {
		long startTime = System.currentTimeMillis();
		Object result = ctx.proceed();
		System.out.println(
				String.format("Execution time of (%s)=%d ms",ctx.getMethod().getName(),
						System.currentTimeMillis()-startTime));
		return result;
	}

}
